const MessageTray = imports.ui.messageTray;
const Overview = imports.ui.overview;
const Panel = imports.ui.panel;
+const Params = imports.misc.params;
const RunDialog = imports.ui.runDialog;
const Layout = imports.ui.layout;
const LookingGlass = imports.ui.lookingGlass;
/**
* pushModal:
* @actor: #ClutterActor which will be given keyboard focus
- * @timestamp: optional timestamp
+ * @params: optional parameters
*
* Ensure we are in a mode where all keyboard and mouse input goes to
* the stage, and focus @actor. Multiple calls to this function act in
* modal stack returns to this actor, reset the focus to the actor
* which was focused at the time pushModal() was invoked.
*
- * @timestamp is optionally used to associate the call with a specific user
- * initiated event. If not provided then the value of
- * global.get_current_time() is assumed.
+ * @params may be used to provide the following parameters:
+ * - timestamp: used to associate the call with a specific user initiated
+ * event. If not provided then the value of
+ * global.get_current_time() is assumed.
*
- * @options: optional Meta.ModalOptions flags to indicate that the
- * pointer is alrady grabbed
+ * - options: Meta.ModalOptions flags to indicate that the pointer is
+ * already grabbed
*
* Returns: true iff we successfully acquired a grab or already had one
*/
-function pushModal(actor, timestamp, options) {
- if (timestamp == undefined)
- timestamp = global.get_current_time();
+function pushModal(actor, params) {
+ params = Params.parse(params, { timestamp: global.get_current_time(),
+ options: 0 });
if (modalCount == 0) {
- if (!global.begin_modal(timestamp, options ? options : 0)) {
+ if (!global.begin_modal(params.timestamp, params.options)) {
log('pushModal: invocation of begin_modal failed');
return false;
}
if (this.state == State.OPENED || this.state == State.OPENING)
return true;
- if (!this.pushModal(timestamp))
+ if (!this.pushModal({ timestamp: timestamp }))
return false;
this._fadeOpen(onPrimary);
pushModal: function (timestamp) {
if (this._hasModal)
return true;
- if (!Main.pushModal(this._group, timestamp))
+ if (!Main.pushModal(this._group, { timestamp: timestamp }))
return false;
this._hasModal = true;